//
//  KLLocalVideoCell.m
//  WebRTCDemo_iOS
//
//  Created by szblsx2 on 2020/3/9.
//  Copyright © 2020 szblsx2. All rights reserved.
//

#import "KLLocalVideoCell.h"

@interface KLLocalVideoCell ()
//渲染视图
@property (nonatomic, strong) RTCCameraPreviewView *previewView;

@end

@implementation KLLocalVideoCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        _previewView = [[RTCCameraPreviewView alloc] initWithFrame:frame];
        [self addSubview:_previewView];
        self.clipsToBounds = YES;
    }
    return self;
}

- (void)setCaptureSession:(AVCaptureSession *)captureSession
{
    _previewView.captureSession = captureSession;
    AVCaptureVideoPreviewLayer *videoLayer = (AVCaptureVideoPreviewLayer *)_previewView.layer;
    videoLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
}

@end
